"use client";

import { useEffect, useState } from "react";

interface IProps {
  params: { id: string };
}

interface IData {
  id: string;
  name: string;
  desc: string;
  content: string;
}
export default function ListDetail({ params }: IProps) {
  const [data, setData] = useState({} as IData);
  useEffect(() => {
    fetch(`/api/goods/${params.id}`)
      .then((res) => res.json())
      .then((res) => {
        setData(res.data);
      });
  }, [params.id]);
  return (
    <div>
      <p>name: {data.name}.</p>
      <p>desc: {data.desc}.</p>
      <p>content: {data.content}.</p>
    </div>
  );
}
